home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
UTILITY
/
DOSPAS10.ARJ
/
DOSPASS.C
next >
Wrap
C/C++ Source or Header
|
1991-11-14
|
2KB
|
111 lines
/*
* DOSpass v1.0 Author: Daniel Sherer November, 1991
*
* Ferrets out the passwords from the 'DOSSHELL' v5.0 menu system.
*/
static char Ident[] = {"DOSpass v1.0 By: Daniel Sherer, Nov 91"};
#include <stdio.h>
#include "string.h"
#define MAXLEN 1024
#define NULL 0
#define TRUE (1)
#define FALSE (0)
#define EOF (-1)
#define NL 0x0A
#define CR 0x0D
main(argc, argv)
int argc;
char **argv;
{
FILE *ini_file;
char byte, buffer[MAXLEN];
int no_more_lines;
int sub;
char filepath[40];
char title[41], passwd[41];
char *bptr;
if( argc < 2 ) {
strcpy(filepath,"\\dos");
printf("\n\rScanning default directory (%s).\r\n\n", filepath);
}
else {
strcpy(filepath,argv[1]);
}
strcat(filepath,"\\dosshell.ini");
if((ini_file=fopen(filepath,"r")) == NULL) {
printf("\r\nCannot open file '%s'\r\n\n", filepath);
exit(10);
}
no_more_lines = FALSE;
title[0] = passwd[0] = NULL;
while ( ! no_more_lines) {
bptr = buffer;
while ((byte = getc(ini_file)) != EOF) {
if (byte == NL)
break;
else
*bptr++ = byte;
}
*bptr = NULL;
no_more_lines = feof(ini_file);
bptr=strstr(buffer,"color ="); /* Did we find 'color =' ? */
if (bptr)
if (bptr == buffer) /* At the Begining of line? */
break; /* We're done! */
bptr=strstr(buffer,"program =");
if (bptr) {
if (title[0] > NULL)
showitem(&title, &passwd);
title[0] = NULL;
passwd[0] = NULL;
continue;
}
bptr=strstr(buffer,"title =");
if (bptr) {
for (bptr+=8,sub=0; *bptr!=NULL; bptr++) {
title[sub++] = *bptr;
if (sub > 40) {
title[40] = NULL;
continue;
}
}
title[sub] = NULL;
}
bptr=strstr(buffer,"password =");
if (bptr) {
for (bptr+=11,sub=0; *bptr!=NULL; bptr++) {
passwd[sub++] = *bptr;
if (sub > 40) {
passwd[40] = NULL;
continue;
}
}
passwd[sub] = NULL;
}
}
if (title[0])
showitem(&title, &passwd);
printf("\r\nIf present, passwords appear in {}\r\n");
exit(0);
}
showitem(t,p)
char *t, *p;
{
if (*p != NULL)
printf("Menu Item-> %s \t{%s}\r\n", t, p);
else
printf("Menu Item-> %s\r\n", t);
}